package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
/*
    根据表名来对应的话，我们这个Mapper名就叫SetmealDishMapper
 */
@Mapper
public interface SetmealDishMapper {

    /**
     * 根据多个菜品id来查询对应的套餐id
     * @param dishIds
     * @return
     */

    List<SetmealDish> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 动态批量插入数据
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据
     * @param setmeal_ids
     */
    void deleteByIds(List<Long> setmeal_ids);

    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getBySetmealId(Long id);

    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);
}
